fix: Fix restartRequired flag#31947
Conversation
| } | ||
| await this.publishInfo(); | ||
| return utils.getResponse(message, {restart_required: this.restartRequired}); | ||
| return utils.getResponse(message, {restart_required: newRestartRequired}); |
There was a problem hiding this comment.
| return utils.getResponse(message, {restart_required: newRestartRequired}); | |
| return utils.getResponse(message, {restart_required: this.restartRequired}); |
should stay required on consecutive saves if any previous save resulted in "required".
Looks like we don't have a test for this?
There was a problem hiding this comment.
To me it makes sense the response to changing an option should tell if that option needs a restart, not if the system does. (But I don't mind changing it)
For the tests just change some options and see if this.restartRequired is set correctly? settings.test.ts is fine?
There was a problem hiding this comment.
I guess it depends if we want the bridge to keep in sync with the per-save response. I guess there's an argument for both 😅
We'd have to change the logic elsewhere too though:
zigbee2mqtt/lib/extension/bridge.ts
Line 475 in 94751ab
Frontend uses only bridge/info, so, no effect there.
We should test consecutive changes (through bridge topics) and match resulting bridge/info state and topic response state. In extensions/bridge.test.ts.
I found a bug:
But of course Z2M still requires a restart to apply the first option.
Also changed the log message to inform the user.